//
//  FoundDataModel.m
//  QuickReadComic
//
//  Created by 苗钧豪 on 16/9/8.
//  Copyright © 2016年 苗钧豪. All rights reserved.
//

#import "FoundDataModel.h"

@implementation FoundDataModel
- (void)setValue:(id)value forKey:(NSString *)key {
    [super setValue:value forKey:key];
    if ([key isEqualToString:@"topics"]) {
        NSMutableArray<FoundTopicsModel *> *array = [NSMutableArray array];
        for (NSDictionary *dic in value) {
            FoundTopicsModel *topics = [FoundTopicsModel modelWithDic:dic];
            [array addObject:topics];
        }
        _topics = array;
    } else if ([key isEqualToString:@"tags"]) {
        NSMutableArray<FoundTagsModel *> *array = [NSMutableArray array];
        for (NSDictionary *dic in value) {
            FoundTagsModel *tags = [FoundTagsModel modelWithDic:dic];
            [array addObject:tags];
        }
        _tags = array;
    }
}
+ (NSDictionary *)objectClassInArray{
    return @{@"topics" : [FoundTopicsModel class],@"tags" : [FoundTagsModel class]};
}
@end
